Skip to content

optimize load-client.ts for bundlesize - #7998

Open
schiller-manuel wants to merge 4 commits into
mainfrom
bundlesize-load-client
Open

optimize load-client.ts for bundlesize#7998
schiller-manuel wants to merge 4 commits into
mainfrom
bundlesize-load-client

Conversation

@schiller-manuel

@schiller-manuel schiller-manuel commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Improved loader state handling so successful loads clear previous errors correctly.
    • Prevented redirects from applying unintended state changes.
    • Improved not-found boundary updates and pending UI behavior.
    • Ensured commit operations finish cleanly across successful, failed, restored, and rolled-back transitions.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 402c88bd-8944-4c50-a789-4d267b3c583c

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and 78f53f3.

📒 Files selected for processing (1)
  • packages/router-core/src/load-client.ts

📝 Walkthrough

Walkthrough

Changes

Client loader state handling

Layer / File(s) Summary
Loader settlement and planning
packages/router-core/src/load-client.ts
Redirects exit without mutation. Successful settlement clears errors before storing data or marking invalid matches. Loader planning uses normalized function and preload eligibility values.
Boundary and pending presentation
packages/router-core/src/load-client.ts
Not-found handling reapplies the selected boundary. Pending presentation reveals successful fallback matches immediately.
Commit resolution across outcomes
packages/router-core/src/load-client.ts
resolveCommit clears pending commit promises during rollback, restoration, successful transactions, and route-loading failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • TanStack/router#7805: Introduces the lane-based client loader implementation refined by these changes.

Suggested reviewers: sheraff

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: optimizing load-client.ts to reduce bundle size.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bundlesize-load-client

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 78f53f3

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 5m 11s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 24s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 10:24:59 UTC

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@schiller-manuel
schiller-manuel requested a review from Sheraff August 7, 2026 23:29
@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7998

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7998

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7998

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7998

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7998

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7998

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7998

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7998

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7998

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7998

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7998

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7998

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7998

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7998

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7998

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7998

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7998

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7998

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7998

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7998

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7998

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7998

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7998

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7998

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7998

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7998

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7998

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7998

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7998

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7998

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7998

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7998

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7998

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7998

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7998

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7998

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7998

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7998

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7998

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7998

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7998

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7998

commit: 78f53f3

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 411d0166e424
  • Measured at: 2026-08-08T10:20:54.455Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 83.88 KiB -21 B (-0.02%) 83.75 KiB 262.46 KiB 73.01 KiB █████████▁▁▁
react-router.full 87.39 KiB -7 B (-0.01%) 87.25 KiB 274.18 KiB 76.04 KiB █████████▁▁▁
solid-router.minimal 33.20 KiB -20 B (-0.06%) 33.07 KiB 96.29 KiB 29.95 KiB █████████▁▁▁
solid-router.full 38.03 KiB -16 B (-0.04%) 37.91 KiB 110.93 KiB 34.26 KiB █████████▁▁▁
vue-router.minimal 49.48 KiB -13 B (-0.03%) 49.36 KiB 138.04 KiB 44.66 KiB █████████▁▁▁
vue-router.full 55.06 KiB -13 B (-0.02%) 54.94 KiB 156.22 KiB 49.58 KiB █████████▁▁▁
react-start.minimal 96.66 KiB -5 B (-0.01%) 96.52 KiB 304.63 KiB 83.76 KiB █████████▁▁▁
react-start.deferred-hydration 97.38 KiB -5 B (-0.01%) 96.54 KiB 305.98 KiB 84.31 KiB █████████▁▁▁
react-start.full 99.84 KiB +1 B (+0.00%) 99.70 KiB 314.35 KiB 86.43 KiB █████████▁▁▁
react-start.rsbuild.minimal 99.98 KiB -11 B (-0.01%) 99.81 KiB 315.17 KiB 86.29 KiB ▁▁▁▇▇▇▇████▇
react-start.rsbuild.minimal-iife 100.39 KiB -14 B (-0.01%) 100.22 KiB 316.11 KiB 86.59 KiB ▁▁▁▇▇▆▆████▇
react-start.rsbuild.full 103.30 KiB -15 B (-0.01%) 103.13 KiB 325.26 KiB 89.00 KiB ▁▁▁▆▆▅▅████▇
solid-start.minimal 45.93 KiB -10 B (-0.02%) 45.81 KiB 137.30 KiB 40.87 KiB █████████▁▁▁
solid-start.deferred-hydration 49.02 KiB +13 B (+0.03%) 45.88 KiB 144.76 KiB 43.69 KiB █████████▁▁▁
solid-start.full 51.02 KiB -1 B (-0.00%) 50.89 KiB 152.68 KiB 45.22 KiB █████████▁▁▁
vue-start.minimal 65.50 KiB +15 B (+0.02%) 65.38 KiB 188.80 KiB 58.27 KiB █████████▁▁▁
vue-start.full 69.29 KiB +10 B (+0.01%) 69.17 KiB 201.07 KiB 61.50 KiB █████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@codspeed-hq

codspeed-hq Bot commented Aug 7, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 17.18%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
❌ 6 regressed benchmarks
✅ 170 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server error-paths not-found (vue) 318.6 KB 2,130.5 KB -85.04%
Memory mem client unique-location-churn (solid) 341.6 KB 588.7 KB -41.97%
Simulation ssr dehydrate rich types (solid) 87.3 ms 99.8 ms -12.49%
Memory mem client navigation-churn (solid) 570.2 KB 621 KB -8.18%
Simulation ssr dehydrate plain control (solid) 119.6 ms 129.3 ms -7.51%
Simulation ssr control-flow route headers (react) 85 ms 87.8 ms -3.23%
Memory mem server error-paths redirect (solid) 588.2 KB 277.9 KB ×2.1
Memory mem client preload-churn (vue) 776.2 KB 735.9 KB +5.47%
Simulation ssr control-flow unmatched 404 (react) 67.2 ms 64.1 ms +4.82%
Simulation ssr request loop (solid) 158 ms 152 ms +3.98%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing bundlesize-load-client (78f53f3) with main (c568caf)

Open in CodSpeed

@schiller-manuel
schiller-manuel force-pushed the bundlesize-inline-isserver branch from a28b3d3 to 5f744df Compare August 7, 2026 23:53
@schiller-manuel
schiller-manuel force-pushed the bundlesize-load-client branch from e5f94a7 to b0c1139 Compare August 7, 2026 23:53
@schiller-manuel
schiller-manuel force-pushed the bundlesize-inline-isserver branch from 5f744df to 8c88574 Compare August 8, 2026 00:04
@schiller-manuel
schiller-manuel requested a review from a team as a code owner August 8, 2026 00:04
Base automatically changed from bundlesize-inline-isserver to main August 8, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants